package file;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class Demo8 {
    public static void main(String[] args) {
        //outputstream 在文件不存在的情况下会尝试创建文件
        //在参数多加true 防止outputstream 清空掉
        try(OutputStream outputStream=new FileOutputStream("./out.txt",true)){
            outputStream.write(97);
            outputStream.write(98);
            outputStream.write(99);
            byte[] bytes={97,98,99};
            outputStream.write(bytes);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
